<?php 
	include 'db.php'; 
	
	 
	function displayItemInfo(){		
		echo '<tr>';
        echo '    	<th></th>';   
        echo '        	<th>Item Name</th>';
        echo '          <th>Item Description</th>';		                 	
        echo '        	<th>MAG Description</th>';
        echo '          <th>PH Code</th> ';
        echo '          <th>Item Price</th> ';
		echo '          <th>Wattage</th> ';
		echo '			<th>Is Active</th>';
        echo '        </tr>';
        echo '      </thead>';
        echo '  <!-- end thead -->';
        echo '  <!-- start tbody -->';
        echo '   <tbody>';
       
		
		$sql = "SELECT * FROM items";
  		if ($result=mysql_query($sql)) {
	   		while ($row=mysql_fetch_array($result)) {
				$itemStat = ($row['isActive'] == 1)?'yes':'no';  
				$dim = ($row['dimmable'] == 1)?'<option value="1" selected="selected">Yes</option><option value="0">No</option>':'<option value="1">Yes</option><option value="0" selected="selected">No</option>';
				$itemstat = ($row['isActive'] == 1)?'<option value="1" selected="selected">Yes</option><option value="0">No</option>':'<option value="1">Yes</option><option value="0" selected="selected">No</option>';
				echo '     	<tr>';
				echo '     		<td>
				<a class="btn" data-toggle="modal" href="#itemModal'.$row['itemId'].'">edit</a>
				<div id="itemModal'.$row['itemId'].'" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Update Item </h3>
			<legend>'.$row['itemName'].' '.$row['itemDesc'].'</legend>
			</div>
			<form action="adminUpdate.php" method="POST">
			<div class="modal-body">
						<input type="hidden" name="targetItem" value="'.$row['itemId'].'">
						<label>Is this active?</label>
						<select name="isActive" id="isActive">'.$itemstat.'</select>
						
						<label>MAG Description</label>
            			<input type="text" name="magDesc" id="magDesc"  value="'.$row['magDesc'].'">
            
             			<label>PH Code</label>
            			<input type="text" name="phCode" id="phCode"  value="'.$row['phCode'].'">
           
            			<label>Item Name</label>
						<input type="text" name="itemName" id="itemName"  value="'.$row['itemName'].'">						 
            
						<label>Item Description</label>
						<input type="text" name="itemDesc" id="itemDesc"  value="'.$row['itemDesc'].'">						 
            
						<label>Item Price</label>
						<input type="text" name="itemPrice" id="itemPrice"  value="'.$row['itemPrice'].'">						      
						            			            
						 <label>Wattage</label>
						<input type="text" name="watts" id="watts"  value="'.$row['wattage'].'">
            
						<label>Comparable Halogen Wattage</label>
						<input type="text" name="chw" id="chw"  value="'.$row['halogenWatt'].'">
            
						<label>Socket</label>
						<input type="text" name="socket" id="socket"  value="'.$row['socket'].'">
            
						<label>Beam Intensity</label>
						<input type="text" name="binsten" id="binsten"  value="'.$row['beamInt'].'">
            
						<label>Beam Angle</label>
						<input type="text" name="bangle" id="bangle"  value="'.$row['beamAngle'].'">
            
						<label>LifeTime</label>
						<input type="text" name="lifetime" id="lifetime"  value="'.$row['lifetime'].'">
                        
						<label>Dimmable*</label>
						<select name="dimmable" id="dimmable">'.$dim.'</select>
            
						<label>Lumen Output</label>
						<input type="text" name="lumout" id="lumout"  value="'.$row['lumenOutput'].'">
						
						<label>Efficacy</label>
						<input type="text" name="effi" id="effi"  value="'.$row['efficacy'].'">
						
						<label>Units Per Pack</label>
						<input type="text" name="upp" id="upp"  value="'.$row['unitsPerPack'].'">
						
						 <label>Color Rendering Index</label>
						<input type="text" name="cri" id="cri"  value="'.$row['colorRendering'].'">
						
						<label>Color Temperature</label>
						<input type="text" name="colorTemp" id="colorTemp"  value="'.$row['colorTemp'].'">
						
						<label>12NC 929000</label>
						<input type="text" name="nc" id="nc"  value="'.$row['NC'].'">
						
						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
							<button class="btn btn-primary" type="submit">Save changes</button>
						</div>
						</form>
					</div>				
				</td>';
				echo '     		<td>'.$row['itemName'].'</td>';
				echo '     		<td>'.$row['itemDesc'].'</td>';			
				echo '     		<td><p class="small">'.$row['magDesc'].'</p></td>';
				echo '     		<td><p class="small">'.$row['phCode'].'</p></td>';
				echo '     		<td><p class="small">'.$row['itemPrice'].'</p></td>';
				echo '     		<td><p class="small">'.$row['wattage'].'</p></td>';   			 
				echo '			<td><p class="small">'.$itemStat.'</p></td>';                          
				echo ' 		</tr>';
			} // end while
		} // end if
	} // end displayItemInfo function
	
	function displayItemDesc1(){
		echo '<tr>';
        echo '    	<th></th>';   
        echo '        	<th>Item Name</th>';
        echo '          <th>Item Description</th>';		
        echo '          <th>Comparable Halogen Wattage</th> ';
        echo '          <th>Socket</th> ';
		echo '          <th>Beam Intensity</th> ';
		echo '          <th>Beam Angle</th> ';
		
        echo '        </tr>';
        echo '      </thead>';
        echo '  <!-- end thead -->';
        echo '  <!-- start tbody -->';
        echo '   <tbody>';
       
		
		$sql = "SELECT * FROM items";
  		if ($result=mysql_query($sql)) {
	   		while ($row=mysql_fetch_array($result)) {
				echo '     	<tr>';
				echo '     		<td>
				<a class="btn" data-toggle="modal" href="#itemModal'.$row['itemId'].'">edit</a>
				<div id="itemModal'.$row['itemId'].'" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Update Item </h3>
			<legend>'.$row['itemName'].' '.$row['itemDesc'].'</legend>
			</div>
			<form action="adminUpdate.php" method="POST">
			<div class="modal-body">
						<input type="hidden" name="targetItem" value="'.$row['itemId'].'">
						<label>MAG Description</label>
            			<input type="text" name="magDesc" id="magDesc"  placeholder="MAG Description">
            
             			<label>PH Code</label>
            			<input type="text" name="phCode" id="phCode"  placeholder="Ph Code">
           
            			<label>Item Name</label>
						<input type="text" name="itemName" id="itemName"  placeholder="name of item">
						<span class="help-block">Type in the name of the item you want to add.</span>
            
						<label>Item Description</label>
						<input type="text" name="itemDesc" id="itemDesc"  placeholder="description of item">
						<span class="help-block">Type in the description of the item you want to add.</span>
            
						<label>Item Price</label>
						<input type="text" name="itemPrice" id="itemPrice"  placeholder="Price of item">
						<span class="help-block">Type in the Price of the item.</span>            
						 
            			<span class="help-block">Select the group which this product belongs.</span>
            
						 <label>Wattage</label>
						<input type="text" name="watts" id="watts"  placeholder="Wattage">
            
						<label>Comparable Halogen Wattage</label>
						<input type="text" name="chw" id="chw"  placeholder="Comparable Halogen Wattage">
            
						<label>Socket</label>
						<input type="text" name="socket" id="socket"  placeholder="Socket">
            
						 <label>Bulb Shape</label>
						<input type="text" name="bshape" id="bshape"  placeholder="Bulb Shape here">
            
						<label>Beam Intensity</label>
						<input type="text" name="binsten" id="binsten"  placeholder="Beam Intensity">
            
						<label>Beam Angle</label>
						<input type="text" name="bangle" id="bangle"  placeholder="Beam Angle">
            
						<label>LifeTime</label>
						<input type="text" name="lifetime" id="lifetime"  placeholder="Lifetime">
                        
						<label>Dimmable*</label>
						<select name="dimmable" id="dimmable">
						  <option value="1">Yes</option>
						  <option value="0">No</option>              
						</select>
            
						<label>Lumen Output</label>
						<input type="text" name="lumout" id="lumout"  placeholder="Lumen Output">
						
						<label>Efficacy</label>
						<input type="text" name="effi" id="effi"  placeholder="Efficacy">
						
						<label>Units Per Pack</label>
						<input type="text" name="upp" id="upp"  placeholder="Units Per Pack">
						
						 <label>Color Rendering Index</label>
						<input type="text" name="cri" id="cri"  placeholder="Color Rendering Index">
						
						<label>Color Temperature</label>
						<input type="text" name="colorTemp" id="colorTemp"  placeholder="Color Temperature">
						
						<label>12NC 929000</label>
						<input type="text" name="nc" id="nc"  placeholder="12NC 929000">
						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
							<button class="btn btn-primary" type="submit">Save changes</button>
						</div>
						</form>
					</div>				
				</td>';
				echo '     		<td>'.$row['itemName'].'</td>';
				echo '     		<td>'.$row['itemDesc'].'</td>';			
				
				echo '     		<td><p class="small">'.$row['halogenWatt'].'</p></td>';
				echo '     		<td><p class="small">'.$row['socket'].'</p></td>';   
				echo '     		<td><p class="small">'.$row['beamInt'].'</p></td>'; 
				echo '     		<td><p class="small">'.$row['beamAngle'].'</p></td>';				            
				echo ' 		</tr>';
			} // end while
		} // end if
	} // end displayItemDesc1 function
	
	function displayItemDesc2(){		
		echo '<tr>';
        echo '    	<th></th>';   
        echo '        	<th>Item Name</th>';
        echo '          <th>Item Description</th>';		
        echo '          <th>Lifetime</th> ';
        echo '          <th>Dimmable</th> ';
		echo '          <th>Lumen Output</th> ';
		echo '          <th>Efficacy</th> ';
        echo '        </tr>';
        echo '      </thead>';
        echo '  <!-- end thead -->';
        echo '  <!-- start tbody -->';
        echo '   <tbody>';
       
		
		$sql = "SELECT * FROM items";
  		if ($result=mysql_query($sql)) {
	   		while ($row=mysql_fetch_array($result)) {
				$dim = ($row['dimmable'] == 1)?'<option value="1" selected="selected">Yes</option><option value="0">No</option>':'<option value="1">Yes</option><option value="0" selected="selected">No</option>';
				$itemstat = ($row['isActive'] == 1)?'<option value="1" selected="selected">Yes</option><option value="0">No</option>':'<option value="1">Yes</option><option value="0" selected="selected">No</option>';
				echo '     	<tr>';
				echo '     		<td>
				<a class="btn" data-toggle="modal" href="#itemModal'.$row['itemId'].'">edit</a>
				<div id="itemModal'.$row['itemId'].'" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Update Item </h3>
			<legend>'.$row['itemName'].' '.$row['itemDesc'].'</legend>
			</div>
			<form action="adminUpdate.php" method="POST">
			<div class="modal-body">
						<input type="hidden" name="targetItem" value="'.$row['itemId'].'">
						<label>Is this active?</label>
						<select name="isActive" id="isActive">'.$itemstat.'</select>
						
						<label>MAG Description</label>
            			<input type="text" name="magDesc" id="magDesc"  placeholder="'.$row['magDesc'].'">
            
             			<label>PH Code</label>
            			<input type="text" name="phCode" id="phCode"  placeholder="'.$row['phCode'].'">
           
            			<label>Item Name</label>
						<input type="text" name="itemName" id="itemName"  placeholder="'.$row['itemName'].'">						 
            
						<label>Item Description</label>
						<input type="text" name="itemDesc" id="itemDesc"  placeholder="'.$row['itemDesc'].'">						 
            
						<label>Item Price</label>
						<input type="text" name="itemPrice" id="itemPrice"  placeholder="'.$row['itemPrice'].'">						      
						            			            
						 <label>Wattage</label>
						<input type="text" name="watts" id="watts"  placeholder="'.$row['wattage'].'">
            
						<label>Comparable Halogen Wattage</label>
						<input type="text" name="chw" id="chw"  placeholder="'.$row['halogenWatt'].'">
            
						<label>Socket</label>
						<input type="text" name="socket" id="socket"  placeholder="'.$row['socket'].'">
            
						<label>Beam Intensity</label>
						<input type="text" name="binsten" id="binsten"  placeholder="'.$row['beamInt'].'">
            
						<label>Beam Angle</label>
						<input type="text" name="bangle" id="bangle"  placeholder="'.$row['beamAngle'].'">
            
						<label>LifeTime</label>
						<input type="text" name="lifetime" id="lifetime"  placeholder="'.$row['lifetime'].'">
                        
						<label>Dimmable*</label>
						<select name="dimmable" id="dimmable">'.$dim.'</select>
            
						<label>Lumen Output</label>
						<input type="text" name="lumout" id="lumout"  placeholder="'.$row['lumenOutput'].'">
						
						<label>Efficacy</label>
						<input type="text" name="effi" id="effi"  placeholder="'.$row['efficacy'].'">
						
						<label>Units Per Pack</label>
						<input type="text" name="upp" id="upp"  placeholder="'.$row['unitsPerPack'].'">
						
						 <label>Color Rendering Index</label>
						<input type="text" name="cri" id="cri"  placeholder="'.$row['colorRendering'].'">
						
						<label>Color Temperature</label>
						<input type="text" name="colorTemp" id="colorTemp"  placeholder="'.$row['colorTemp'].'">
						
						<label>12NC 929000</label>
						<input type="text" name="nc" id="nc"  placeholder="'.$row['NC'].'">
						
						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
							<button class="btn btn-primary" type="submit">Save changes</button>
						</div>
						</form>
					</div>				
				</td>';
				echo '     		<td>'.$row['itemName'].'</td>';
				echo '     		<td>'.$row['itemDesc'].'</td>';			
				
				echo '     		<td><p class="small">'.$row['lifetime'].'</p></td>';
				echo '     		<td><p class="small">'.$row['dimmable'].'</p></td>';   
				echo '     		<td><p class="small">'.$row['lumenOutput'].'</p></td>'; 
				echo '     		<td><p class="small">'.$row['efficacy'].'</p></td>';                       
				echo ' 		</tr>';
			} // end while
		} // end if
	} // end displayItemDesc2 function
	function displayItemDesc3(){		
		echo '<tr>';
        echo '    	<th></th>';
        echo '        	<th>Item Name</th>';
        echo '          <th>Item Description</th>';		
        echo '          <th>Units Per Pack</th> ';
        echo '          <th>Color Rendering</th> ';
		echo '          <th>Color Temperature</th> ';
		echo '          <th>12NC 929000</th> ';		
        echo '        </tr>';
        echo '      </thead>';
        echo '  <!-- end thead -->';
        echo '  <!-- start tbody -->';
        echo '   <tbody>';
       
		
		$sql = "SELECT * FROM items";
  		if ($result=mysql_query($sql)) {
	   		while ($row=mysql_fetch_array($result)) {
				$dim = ($row['dimmable'] == 1)?'<option value="1" selected="selected">Yes</option><option value="0">No</option>':'<option value="1">Yes</option><option value="0" selected="selected">No</option>';
				$itemstat = ($row['isActive'] == 1)?'<option value="1" selected="selected">Yes</option><option value="0">No</option>':'<option value="1">Yes</option><option value="0" selected="selected">No</option>';
				echo '     	<tr>';
				echo '     		<td>
				<a class="btn" data-toggle="modal" href="#itemModal'.$row['itemId'].'">edit</a>
				<div id="itemModal'.$row['itemId'].'" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
			<h3 id="myModalLabel">Update Item </h3>
			<legend>'.$row['itemName'].' '.$row['itemDesc'].'</legend>
			</div>
			<form action="adminUpdate.php" method="POST">
			<div class="modal-body">
						<input type="hidden" name="targetItem" value="'.$row['itemId'].'">
						<label>Is this active?</label>
						<select name="isActive" id="isActive">'.$itemstat.'</select>
						
						<label>MAG Description</label>
            			<input type="text" name="magDesc" id="magDesc"  placeholder="'.$row['magDesc'].'">
            
             			<label>PH Code</label>
            			<input type="text" name="phCode" id="phCode"  placeholder="'.$row['phCode'].'">
           
            			<label>Item Name</label>
						<input type="text" name="itemName" id="itemName"  placeholder="'.$row['itemName'].'">						 
            
						<label>Item Description</label>
						<input type="text" name="itemDesc" id="itemDesc"  placeholder="'.$row['itemDesc'].'">						 
            
						<label>Item Price</label>
						<input type="text" name="itemPrice" id="itemPrice"  placeholder="'.$row['itemPrice'].'">						      
						            			            
						 <label>Wattage</label>
						<input type="text" name="watts" id="watts"  placeholder="'.$row['wattage'].'">
            
						<label>Comparable Halogen Wattage</label>
						<input type="text" name="chw" id="chw"  placeholder="'.$row['halogenWatt'].'">
            
						<label>Socket</label>
						<input type="text" name="socket" id="socket"  placeholder="'.$row['socket'].'">
            
						<label>Beam Intensity</label>
						<input type="text" name="binsten" id="binsten"  placeholder="'.$row['beamInt'].'">
            
						<label>Beam Angle</label>
						<input type="text" name="bangle" id="bangle"  placeholder="'.$row['beamAngle'].'">
            
						<label>LifeTime</label>
						<input type="text" name="lifetime" id="lifetime"  placeholder="'.$row['lifetime'].'">
                        
						<label>Dimmable*</label>
						<select name="dimmable" id="dimmable">'.$dim.'</select>
            
						<label>Lumen Output</label>
						<input type="text" name="lumout" id="lumout"  placeholder="'.$row['lumenOutput'].'">
						
						<label>Efficacy</label>
						<input type="text" name="effi" id="effi"  placeholder="'.$row['efficacy'].'">
						
						<label>Units Per Pack</label>
						<input type="text" name="upp" id="upp"  placeholder="'.$row['unitsPerPack'].'">
						
						 <label>Color Rendering Index</label>
						<input type="text" name="cri" id="cri"  placeholder="'.$row['colorRendering'].'">
						
						<label>Color Temperature</label>
						<input type="text" name="colorTemp" id="colorTemp"  placeholder="'.$row['colorTemp'].'">
						
						<label>12NC 929000</label>
						<input type="text" name="nc" id="nc"  placeholder="'.$row['NC'].'">
						
						</div>
						<div class="modal-footer">
							<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
							<button class="btn btn-primary" type="submit">Save changes</button>
						</div>
						</form>
					</div>				
				</td>';
				echo '     		<td>'.$row['itemName'].'</td>';
				echo '     		<td>'.$row['itemDesc'].'</td>';			
				
				echo '     		<td><p class="small">'.$row['unitsPerPack'].'</p></td>';
				echo '     		<td><p class="small">'.$row['colorRendering'].'</p></td>';   
				echo '     		<td><p class="small">'.$row['colorTemp'].'</p></td>'; 
				echo '     		<td><p class="small">'.$row['NC'].'</p></td>';                       
				echo ' 		</tr>';
			} // end while
		} // end if
	} // end displayItemDesc2 function
	

?>